package addon.w3.mdx;

import java.nio.ByteBuffer;
import java.nio.FloatBuffer;

import natv.CoreNative;

import com.jme.math.Matrix4f;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;

public class TempTest {
	public static void main(String args[]) {
		//testRotaLinearFactor();
		//testJNI();
		//natv_testTransLinearFactor();
		//testMatx();
		testShort();
	}
	
	static void testShort() {
		short ii = 0x13;
		System.out.println(0xF0&ii);
	}
	
	static void testMatx2() {
		Matrix4f m = new Matrix4f();
		
	}
	
	//move
	static void testMatx() {
		Vector3f currPos = new Vector3f(3f,3f,3f);
		Matrix4f m4f = new Matrix4f(); //move
		m4f.setTranslation(new Vector3f(-1f,-1f,2f));
		System.out.println(m4f.mult(currPos));
	}
	
	static void testJNI() {
		System.out.println(System.getProperty("java.library.path"));
	}
	
	static void temp() {
		Quaternion quat = new Quaternion(0f,0f,0f,0f);
		FloatBuffer fb = FloatBuffer.allocate(3);
		//fb.put(new float[]{1f,2f});
		float tf = -0.34f;
		fb.put(0,1f);
		fb.put(1,2f);
		System.out.println(fb);
		System.out.println( (-2f*tf) +" fdsfds" +  (-2f*tf*-1f) );
		for(int i=0;i<fb.limit();i++) System.out.println(fb.get(i));		
	}
	
	static void testTransLinearFactor() {
//		80000: { -19.5795, -0.587918, 24.5878 },
//		82000: { -4.61921, 0.213006, 6.49079 },
		float fa = 80000, fb = 82000;
		float time = 80060f;
		float factor = (time-fa) / (fb-fa);
		Vector3f v1 = new Vector3f(-19.5795f, -0.587918f, 24.5878f);
		Vector3f v2 = new Vector3f(-4.61921f, 0.213006f, 6.49079f);
		float inverseFactor = 1.0f - factor;
		v1.multLocal(inverseFactor);
//		System.out.println("v1 : "+v1);
		v2.multLocal(factor);
//		System.out.println("v2 : "+v2);
		Vector3f v3 = v1.addLocal(v2);
		System.out.println("v3 : "+v1);
		
		//time 80030
//		v1 : com.jme.math.Vector3f [X=-19.285809, Y=-0.57909924, Z=24.218983]
//      v2 : com.jme.math.Vector3f [X=-0.06928814, Y=0.00319509, Z=0.09736185]
//      v3 : com.jme.math.Vector3f [X=-19.355097, Y=-0.57590413, Z=24.316345]

		//time 80060
//		v1 : com.jme.math.Vector3f [X=-18.992115, Y=-0.57028043, Z=23.850166]
//      v2 : com.jme.math.Vector3f [X=-0.13857628, Y=0.00639018, Z=0.1947237]
//      v3 : com.jme.math.Vector3f [X=-19.130692, Y=-0.5638903, Z=24.04489]

	}
}
